/**
 * @brief: CRC算法模块
 * @version:
 * @date:
 * @author 宋炜
 */
#ifndef __CRC_HPP__
#define __CRC_HPP__

#include <string>

class CRC
{
public:
	/**
	 * @brief modbus CRC算法
	 */
	static uint16_t MODBUS( const char * data , size_t len );
	/**
	 * @brief
	 */
	static uint16_t CRC16_X25(unsigned char *puchMsg, unsigned int usDataLen);
	static uint16_t CRC16_CCITT_FALSE(unsigned char *puchMsg, unsigned int usDataLen);
	static uint16_t CRC16_CCITT(unsigned char *puchMsg, unsigned int usDataLen);
	static uint16_t CRC16_XMODEM(unsigned char *puchMsg, unsigned int usDataLen);
private:
	static void InvertUint32(unsigned int *dBuf,unsigned int *srcBuf);
	static void InvertUint8(unsigned char *dBuf,unsigned char *srcBuf);
	static void InvertUint16(unsigned short *dBuf,unsigned short *srcBuf);
};
#endif